package com.wnhz.work.yz.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.wnhz.work.yz.R;

import java.util.List;

/**
 * Created by admin on 2016/12/10.
 */
public class TitleAdapter extends RecyclerView.Adapter<TitleAdapter.TitleViewHolder> {
    private Context context;
    private List<String> nameList;

    public TitleAdapter(Context context, List<String> nameList) {
        this.context = context;
        this.nameList = nameList;
    }

    @Override
    public TitleViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.title_item, parent, false);
        TitleViewHolder holder = new TitleViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(TitleViewHolder holder, int position) {
        holder.tv_name.setText(nameList.get(position));
    }

    @Override
    public int getItemCount() {
        return nameList.size();
    }

    class TitleViewHolder extends RecyclerView.ViewHolder {
        TextView tv_name;
        TextView tv_line;

        public TitleViewHolder(View view) {
            super(view);

            tv_name = (TextView) view.findViewById(R.id.tv_name);
            tv_line = (TextView) view.findViewById(R.id.tv_line);
        }
    }
}
